package com.orange.common.binding

import androidx.databinding.BindingAdapter
import com.drake.statelayout.StateLayout
import com.drake.statelayout.Status
import com.orange.common.popup.LoadingPopup

object StateLayoutAdapter{
    @JvmStatic
    @BindingAdapter("bindState")
    fun bindState(view: StateLayout, state: Status) {
        view.apply {
            when (state) {
                Status.LOADING -> showLoading()
                Status.CONTENT -> showContent()
                Status.EMPTY -> showEmpty()
                Status.ERROR -> showError()
            }
        }
    }
}